﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LxjCommon
{
    public class PubConstant
    {
        /// <summary>
        /// 获取连接字符串
        /// </summary>
        public static string ConnectionString
        {
            get
            {
                string _connectionString = "";
                try
                {
                    _connectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
                catch
                {
                    try
                    {
                        _connectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString();
                    }
                    catch
                    {
 
                    }
                }
                return _connectionString;
            }
        }

        /// <summary>
        /// 得到web.config里配置项的数据库连接字符串。
        /// </summary>
        /// <param name="configName"></param>
        /// <returns></returns>
        public static string GetConnectionString(string configName)
        {
            string _connectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            return _connectionString;
        }


    }
}
